package com.yu.core.controller.user;


import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;
import com.yu.model.User;

public class UserValidator extends Validator {

	@Override
	protected void handleError(Controller controller) {
		controller.keepModel(User.class);
	    String actionKey = getActionKey();
	    System.out.println(actionKey);
		if("/user/save".equals(actionKey)){
			controller.render("index.html");
		}
	}

	@Override
	protected void validate(Controller controller) {
		System.out.println("123");
		validateRequiredString("user.name", "nameMsg", "标题不能为空");
		if ("abc".equals(controller.getPara("user.name"))){
			validateUrl("user.name", "nameMsg", "特殊字符");
		}
	}

}
